package com.extra.conf.controller;

import com.extra.conf.StorageConfiguration;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

/**
 * @Classname ExtraController
 * @Description 默认配置文件加载
 * @Date 2021/6/25 11:57
 * @Created by lpc
 */
@RestController
@Slf4j
public class ExtraController {

    @Value("${storage.local.max-size:100000}")
    private String maxSize;

    @Autowired
    private StorageConfiguration storageConfiguration;

    @PostConstruct
    public void init() {
        log.info("Test @Value use method:  Load configuration: max-size = {}", maxSize);
        log.info("Load configuration: root-dir = {}", storageConfiguration.getRootDir());
        log.info("Load configuration: max-size = {}", storageConfiguration.getMaxSize());
        log.info("Load configuration: allowed-types = {}", storageConfiguration.getAllowTypes());

    }

}
